//
//  NSBundle+Extension.m
//  YSUtils
//
//  Created by Apple on 2020/6/1.
//  Copyright © 2020 Apple. All rights reserved.
//

#import "NSBundle+Extension.h"

@implementation NSBundle (Extension)

+ (instancetype)ys_bundleName:(NSString *)bundleName targetClass:(Class)targetClass {
    
    /// 并没有拿到子bundle
    NSBundle *bundle = [NSBundle bundleForClass:targetClass];
    /// 在这个路径下找到子bundle的路径
    NSString *path = [bundle pathForResource:bundleName ofType:@"bundle"];
    /// 根据路径拿到子bundle
    return path ? [NSBundle bundleWithPath:path] : [NSBundle mainBundle];
}

@end
